package QualificationRound.MinesweeperMaster;

import java.io.PrintStream;
import java.util.Scanner;

public class Bate1
{
	private static Scanner in = new Scanner(System.in);
	private static PrintStream out = System.out;

	public static void main(String[] args)
	{
		int current = in.nextInt() + 1;
		for (int i = 1; i < current; i++)
		{
			check(i);
		}
	}

	private static void check(int current)
	{
		int r = in.nextInt();
		int c = in.nextInt();
		int m = in.nextInt();

		if (r == 1)
		{
			String str = "c";
			for(int i=c-m-1; i>0; i--)
			{
				str += ".";
			}
			for(int i=m; i>0; i--)
			{
				str += "*";
			}

			out.println("Case #" + current + ":\n" + str);
		}
		else if(c == 1)
		{
			String str = "c\n";
			for(int i=r-m-1; i>0; i--)
			{
				str += ".\n";
			}
			for(int i=m; i>0; i--)
			{
				str += "*\n";
			}

			out.print("Case #" + current + ":\n" + str);
		}
		else if(c * r - m == 1)
		{
			out.println("Case #" + current + ":");
			
			out.print("c");
			for(int i=c-1; i>0; i--)
			{
				out.print("*");
			}
			out.println();
			
			for(int i=r-1; i>0; i--)
			{
				for(int j=c; j>0; j--)
				{
					out.print("*");
				}
				out.println();
			}
		}
		else if(c * r - m >4)
		{
			int space = c * r - m - 4;
			out.println("Case #" + current + ":");
			
			out.print("c.");
			for(int i=c-2; i>0; i--)
			{
				if(space-- > 0)
					out.print(".");
				else
					out.print("*");
			}
			out.println();
			
			out.print("..");
			for(int i=c-2; i>0; i--)
			{
				if(space-- > 0)
					out.print(".");
				else
					out.print("*");
			}
			out.println();
			
			for(int i=r-2; i>0; i--)
			{
				for(int j=c; j>0; j--)
				{
					if(space-- > 0)
						out.print(".");
					else
						out.print("*");
				}
				out.println();
			}
		}
		else
		{
			out.println("Case #" + current + ":\nImpossible");
		}
	}
}
